;(function ($) {
  $.extend({
    lin_getCookie (key) {
      var str = document.cookie
      var cookies = str.split('; ')
      var objCookie = cookies.reduce((obj, cookie) => {
        var arr = cookie.split('=')
        obj[arr[0]] = decodeURIComponent(arr[1])
        return obj
      }, {})
      return objCookie[key]
    }
  })
})(jQuery)
;(function ($) {
  $.extend({
    lin_setCookie (key, value, option) {
      var cookie = `${key}=${encodeURIComponent(value)}`
    if (option) {
      if (option.path) {
        cookie += `;path=${option.path}`
      }
      if (option.expires) {
        var date = new Date()
        date.setDate(date.getDate() + option.expires)
        cookie += `;expires=${date.toUTCString()}`
      }
    }
      return document.cookie = cookie
    }
  })
})(jQuery)
